package com.netease.financial.data.net;

import com.netease.financial.data.body.LoginBody;
import com.netease.financial.data.body.PageBody;
import com.netease.financial.data.body.RegisterBody;
import com.netease.financial.data.entity.AccessTokenCheckEntity;
import com.netease.financial.data.entity.ActivityPageEntity;
import com.netease.financial.data.entity.AppUpdateEntity;
import com.netease.financial.data.entity.LaunchPageEntity;
import com.netease.financial.data.entity.LoginAdEntity;
import com.netease.financial.data.entity.LoginEntity;
import com.netease.financial.data.entity.LogoutEntity;
import com.netease.financial.data.entity.PageInfoEntity;
import com.netease.financial.data.entity.PartnerLogosEntity;
import com.netease.financial.data.entity.RegisterEntity;
import com.netease.financial.data.entity.UnreadMessageCountEntity;

import java.util.List;
import java.util.Map;
import java.util.Set;

import retrofit.http.Body;
import retrofit.http.GET;
import retrofit.http.Header;
import retrofit.http.Headers;
import retrofit.http.POST;
import retrofit.http.Query;
import retrofit.http.QueryMap;
import rx.Observable;

/**
 * Created by wyf on 8/2/15.
 */
public interface NfsRestApiService {

    // The version code of api, also called api level, mainly for '/page/pageInfo' interface.
    int API_VERSION_CODE = 1;

    @GET("/content/appLatest")
    Observable<AppUpdateEntity> getAppUpdateInfo(
            @Query("device") String device,
            @Query("versionCode") int versionCode);

    @GET("/notice/siteMsgUnreadCount")
    Observable<UnreadMessageCountEntity> getUnreadMessageCount(
            @Header("x-auth-token") String accessToken);

    @Headers("Content-Type: application/json; charset=utf-8")
    @POST("/security/login")
    Observable<LoginEntity> login(
            @Body LoginBody body,
            @Header("AppSecret") String appSecret);

    @Headers("Content-Type: application/json; charset=utf-8")
    @POST("/security/logout")
    Observable<LogoutEntity> logout(
            @Header("x-auth-token") String accessToken,
            @Header("AppSecret") String appSecret);

    @GET("/security/tokenCheck")
    Observable<AccessTokenCheckEntity> checkAccessToken(
            @Query("x-auth-token") String accessToken,
            @Header("AppSecret") String appSecret);

    @GET("/ad/tab")
    Observable<ActivityPageEntity> getActivityPageInfo();

    @GET("/ad/launchPage")
    Observable<LaunchPageEntity> getLaunchPageInfo(
            @Query("widthPixels") int widthPixels,
            @Query("heightPixels") int heightPixels,
            @Query("platform") String platform
    );

    @Headers("Content-Type: application/json; charset=utf-8")
    @POST("/security/register")
    Observable<RegisterEntity> register(
            @Body RegisterBody body,
            @Header("AppSecret") String appSecret);

    @Headers("Content-Type: application/json; charset=utf-8")
    @POST("/page/pageInfo?versionCode=" + API_VERSION_CODE)
    Observable<PageInfoEntity> getPageInfo(
            @Body PageBody body
    );

}
